
<?php
include 'conn.php';

$username = ($_POST['username']);
$password = ($_POST['password']);
//
//if($username != null && $password != null){
//    session_start();
//    $_SESSION['username']=$username;
//    $_SESSION['password']=$password;
//    $home_url = 'login.php';
//    header('Location: '.$home_url);
//}

//$conn->query('set names utf8;');

if($username != null && $password != null){
    $sql="insert into miuzzy.users values('{$username}','{$password}')";
    //$sql="insert into mytest.users values('{$username}','{$password}')";
    if($result = $conn->query($sql)){
        echo "-----新增成功";
    }else{
        echo "-----新增失败";
    }
}

?>


<!DOCTYPE html>
<html>

<form action="register.php" method="post">
    <p>
        <label for="username" class="label">用户名:</label>
        <input name="username" type="text"/>
    <p/>
    <p>
        <label for="password" class="label">密 码:</label>
        <input name="password" type="password"/>
    <p/>
    <p>
        <input type="submit"  value="立即注册"/>
</p>
    <p/>
    <input type="button" onclick="window.location.href='login.php'" value="返回登陆">
    </p>
</form>


</html>
